import 'dart:convert';
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:flutterxc/module/Home_module.dart';
const HOME_URL = 'http://www.devio.org/io/flutter_app/json/home_page.json';
class HomeDao {
  static Future<HomeModule> fetch()async {
    final response = await http.get(HOME_URL);
      if(response.statusCode == 200){
        var res = json.decode(Utf8Decoder().convert(response.bodyBytes));
//        print('$res res666');
        return HomeModule.fromJson(res);
      }else {
        throw Exception('一个未知的错误');
      }
  }
}